package com.prd.dto;


import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * <p>
 * 角色数据表
 * </p>
 *
 * @author lizhaoyi
 * @since 2024-01-09
 */
@Data
@ApiModel(value="SysRoleDO对象", description="角色数据表")
public class SysRoleDTO implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "角色id")
    private Long id;

    @ApiModelProperty(value = "角色名称")
    @NotBlank(message = "角色名称不能为空")
    @Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符")
    private String name;

    @ApiModelProperty(value = "角色标识")
    private String code;

    @ApiModelProperty(value = "角色排序")
    @NotNull(message = "显示顺序不能为空")
    private Integer sort;

    @ApiModelProperty(value = "角色状态0-开启；1-关闭")
    private Integer status;

    @ApiModelProperty(value = "角色类型")
    private Integer type;

    @ApiModelProperty(value = "备注")
    private String remark;

    private String creator;

    private LocalDateTime createTime;

    private String updater;

    private LocalDateTime updateTime;

    private Integer deleted;

    @ApiModelProperty(value = "菜单组")
    private Long[] menuIds;

    @ApiModelProperty(value = "部门组")
    private Long[] deptIds;


    public SysRoleDTO(Long roleId){
        this.id = roleId;
    }

    public SysRoleDTO() {

    }

    public boolean isAdmin() {
        return isAdmin(this.id);
    }

    public static boolean isAdmin(Long roleId) {
        return 1L == roleId  && roleId != null;
    }

}
